package com.legendshop.openportal.sdk.model.request;

import com.legendshop.openportal.sdk.annotation.JsonValid;
import com.legendshop.openportal.sdk.model.BaseRequest;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotNull;

import static com.legendshop.openportal.sdk.model.constants.ApiPathConstants.SUBMIT_VIRTUAL_ORDER;

/**
 * 提交虚拟商品订单
 *
 */
@Data
@ApiModel("提交虚拟商品订单请求")
public class SubmitVirtualOrderRequest extends BaseRequest {

    private static final long serialVersionUID = 1904479605142272211L;

    /**
     * 非空：是
     * 第三方的订单单号，必须在30字符以内
     */
    @ApiModelProperty("第三方的订单单号")
    @NotNull(message = "第三方的订单单号不能为空")
    @Length(max = 30, message = "第三方订单单号要在30字符以内")
    private String thirdOrderNo;

    /**
     * 非空：是
     * 下单商品信息 SubmitSku
     * (最高支持100种商品)
     */
    @ApiModelProperty(value = "下单商品信息", example = "[{“prodId”:商品编号1,“skuId”:规格编号1,”num”:下单数量1,“price”:商品价格}]")
    @JsonValid(target = SubmitOrderRequest.SubmitSku.class, isArrayJson = true, arrayMaxSize = 1)
    @NotNull(message = "下单商品信息不能为空(这里因为是虚拟商品，不能走常规的查询规格的流程)")
    private String sku;

    @ApiModelProperty("充值账号,在直充商品中必填,一般是手机号码，或者QQ号等")
    @Length(max = 100, message = "充值账号,在直充商品中必填,一般是手机号码，或者QQ号等,充值账号最多100个字符")
    private String chargeAccount;

    /**
     * 非空：否
     * 备注（少于100字）
     */
    @ApiModelProperty("备注")
    @Length(max = 100, message = "订单备注最多100个字符")
    private String remark;


    @Override
    @ApiModelProperty(hidden = true)
    public String getApiPath() {
        return SUBMIT_VIRTUAL_ORDER;
    }


}
